package com.lzy.huijinjiazu.mvp.ui.fragment;

import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.lzy.huijinjiazu.R;
import com.lzy.huijinjiazu.di.component.DaggerMyAssetsComponent;
import com.lzy.huijinjiazu.di.module.MyAssetsModule;
import com.lzy.huijinjiazu.mvp.contract.MyAssetsContract;
import com.lzy.huijinjiazu.mvp.presenter.MyAssetsPresenter;
import com.lzy.huijinjiazu.mvp.ui.activity.CustomizedActivity;
import com.lzy.huijinjiazu.mvp.ui.activity.MyCustomerActivity;
import com.lzy.huijinjiazu.mvp.ui.activity.ProfitDetailedActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;


public class MyAssetsFragment extends BaseFragment<MyAssetsPresenter> implements MyAssetsContract.View {


    @BindView(R.id.fl_title)
    FrameLayout mFlTitle;
    @BindView(R.id.tv_money)
    TextView mTvMoney;

    public static MyAssetsFragment newInstance() {
        MyAssetsFragment fragment = new MyAssetsFragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(AppComponent appComponent) {
        DaggerMyAssetsComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .myAssetsModule(new MyAssetsModule(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_my_assets, container, false);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mTvMoney.setText(Html.fromHtml(ArmsUtils.getString(getContext(), R.string.symbol_moeny, "31649")));
    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        mImmersionBar.setTitleBarMarginTop(getActivity(), mFlTitle);
    }


    @OnClick({R.id.ll_my_customer, R.id.ll_profit_detailed, R.id.ll_customized_activity})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_my_customer:
                ArmsUtils.startActivity(MyCustomerActivity.class);
                break;
            case R.id.ll_profit_detailed:
                ArmsUtils.startActivity(ProfitDetailedActivity.class);
                break;
            case R.id.ll_customized_activity:
                ArmsUtils.startActivity(CustomizedActivity.class);
                break;
        }

    }

}
